package com.hlhj.carview.customView

import android.support.v4.view.ViewPager
import android.view.View

/**
 *NeverMore
 *2019/10/22
 **/
class MyPagerTransformer: ViewPager.PageTransformer {

    override fun transformPage(p0: View, p1: Float) {
        if (Math.abs((p1-p1.toInt()))==0f){
            //静止的状态
            if (p1==0f){
                //当前页
                p0.scaleY=1f
                p0.scaleX=1f
            }else{
                //其他页
                p0.scaleY=0.91f
                p0.scaleX=0.91f
            }
        }else{
            //运动状态
            p0.scaleX=(1-(0.09f)*Math.abs((p1)))
            p0.scaleY=(1-(0.09f)*Math.abs((p1)))
//            p0.scaleX=0.7f
//            p0.scaleY=0.7f
        }
    }
}